<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="d" uri="/doone-comm-ui-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link type="text/css" href="<%=path%>/manage/css/new_style.css"
	rel="stylesheet" />
<link type="text/css" href="<%=path%>/manage/css/layout.css"
	rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/manage/css/Tooltip.css" />
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/easyTooltip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/hoverIntent.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript" src="<%=path%>/manage/js/Tooltip.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.methods.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/jquery.validate.defaults.js"></script>
<script type="text/javascript"
	src="<%=path%>/manage/js/My97DatePicker/WdatePicker.js"></script>
<!-- End of Libraries -->

<script language="javascript" type="text/javascript">
	
</script>
</head>

<body>
	<div>
		<p class="sitemap">当前位置：内容管理 > 消息推送管理</p>
		<h1>消息推送管理</h1>
		<div>
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">消息列表</a></li>

				</ul>
				<div id="tabs-2">
					<a
						href='<s:url action="addPnsMessage.action">
												<s:param name="fromUrl">add</s:param>
											</s:url>'
						class="btn_addnew">新增消息</a>
					<table class="fullwidth" cellpadding="0" cellspacing="0" border="0">
						<thead>
							<tr>
								<td>消息标题</td>
								<td>群组</td>
								<td>发送时间</td>
								<td>失效时间</td>
								<td>操作</td>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="msgList">
								<tr>
									<td><s:if test="%{null!=title&&title.length()>15}">
											<s:property value="%{title.substring(0, 15)}" />...
														    </s:if> <s:else>
											<s:property value="title" />
										</s:else></td>
									<td><s:if
											test="%{null!=groupNames&&groupNames.length()>15}">
											<s:property value="%{groupNames.substring(0, 15)}" />...
														    </s:if> <s:else>
											<s:property value="groupNames" />
										</s:else></td>
									<td><s:property value="startDate" /></td>
									<td><s:property value="expireDate" /></td>
									<td><s:if test="flag==0">发送中</s:if> <s:if test="flag==1">
											<a
												href='<s:url action="addPnsMessage.action">
																<s:param name="fromUrl">edit</s:param>
																<s:param name="id" value="%{messageId}"></s:param>
															</s:url>'>编辑</a>
											<a
												href='editMessageGroup.action?messageId=<s:property value="messageId"/>'>选择发送对象</a>
											<script>
												function ckGroup(messageId,
														groupNames) {
													if (groupNames == ''
															|| groupNames == 'undefined') {
														alert("请选择发送对象");
													} else {
														$
																.ajax({
																	url : root
																			+ '/pns/editMessgeStatus.action?messageId='
																			+ messageId,
																	method : 'post',
																	dataType : 'text',
																	success : function(
																			data) {
																		window.location.href = root
																				+ '/pns/getPnsInit.action';
																	},
																	error : function(
																			err) {
																		if (err.responseText != '')
																			alert(err.responseText);
																		else
																			alert("请求失败！");
																	}
																});
													}
												}
											</script>
											<a href='javascript:void(0)'
												onclick="ckGroup('<s:property value="messageId"/>','<s:property value="groupNames" />')">确认发送</a>
										</s:if> <s:if test="flag==2">
															发送完
														</s:if></td>
								</tr>
							</s:iterator>
						</tbody>
					</table>
					<div align="right" style="float: right;">
						<d:page id="page" template="details" skin="gray">
						</d:page>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
